<template>
    <div style="height: 100%;">
        <navbar :title="$t('set_about')" ></navbar>
        <div class="about">
            <div class="backgroung-img">
                <van-image height="100%" :src="require('./images/about.png')" lazy-load />
            </div>
            <div class="about-logo"><img :src="logoImage" alt=""/></div>
            <div class="about-v">{{ $t("set_about_version") }} {{ version }}</div><!--版本-->
        </div>
    </div>
</template>

<script>
import {appInd} from '../../../config/loginConfig';
export default {
    name: 'About',
    data() {
        return {
            logoImage: '',
            version: ''
        };
    },
    methods: {
        getUpdateJson() {
            if (appInd) {
                this.version = window.plus.runtime.version;
            } else {
                this.$axios({
                    method: 'get',
                    url: '/app/api/trainee/app-update-json'
                }).then(res => {
                    if (res) {
                        // TODO: 这里待处理
                        this.version = res.data['Android'].version;
                    }
                });
            }
        }
    },
    mounted() {
        // this.$axios({
        //     method: 'GET',
        //     url: '/app/user/sitePoster'
        // }).then(res => {
        //     let { sitePoster, site } = res.data;
        //     if (sitePoster && sitePoster.login_bg_file1 && sitePoster.login_bg_file1 !== '') {
        //         this.logoImage = `${this.appUrl}/poster/${site}/${sitePoster.sp_logo_file_cn}`;
        //     }
        // });
        const logo = window.localStorage.getItem('about-logo');
        if (logo !== null && logo !== undefined && logo !== '') {
            this.logoImage = logo;
        }
        this.$axios.get('/app/user/single/userlogin/logo/mobile/AboutPage').then(res => {
            if (res.data && res.data.errMsg) {
                if (this.logoImage !== res.data.errMsg) {
                    this.logoImage = this.appUrl + res.data.errMsg;
                    window.localStorage.setItem('about-logo', this.appUrl + res.data.errMsg);
                }
            }
        });
        this.getUpdateJson();
    }
};
</script>

<style scoped lang="less">
    /deep/.van-image__img {
        border-radius: 0px !important;
        display: inline !important;
    }
    .about{
        width: 100%;
        height: 100%;
        .backgroung-img {
            width: 100%;
            height: 100%;
        }
        .about-v{
            position: absolute;
            width: 100%;
            bottom: 15px;
            text-align: center;
            color: #ffffff;
        }
        .about-logo{
            display: block;
            width: 60%;
            position: absolute;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
            margin: 230px auto 0 auto;
            img {
                width: 100%;
            }
        }
    }
</style>
